<script type="text/javascript">
    $(document).ready(function(){
        $("#cat_id").change(function(){
            window.location.href="<?php echo base_url().'admin/tickets/listing/';?>"+this.value;
        });
    });
</script>
<?php
$option_data = array();
foreach ($category_options as $option) {
    $option_data[$option['id']]=$option['name'];
}
?>
<div id="search_item" style="margin: 5px 0 15px;">
    <?php echo form_dropdown('cat_id', $option_data,$selected_cat,'id="cat_id"'); ?>
</div>
<table style="width: 100%;">
    <tr>
        <th scope="col"><?php echo __('image'); ?></th>
        <th scope="col" ><?php echo __('name_of_ticket'); ?></th>
        <th scope="col"><?php echo __('category'); ?></th>
        <th scope="col" class="col_amount"><?php echo __('price'); ?></th>
        <th scope="col"><?php echo __('quantity'); ?></th>
        <th scope="col"><?php echo __('expiry'); ?></th>
        <th scope="col" class="last"><?php echo __('actions'); ?></th>
    </tr>
    <?php foreach ($tickets as $ticket): ?>
        <tr class="hoverall">
            <td style="vertical-align: middle;">
                <img style="margin: 5px;" width="60px" src="<?php echo base_url(); ?>uploads/images/ticket/thumbnail/<?php echo $ticket['img_name']; ?>"/>
            </td>
            <td nowrap="nowrap"><?php echo $ticket['ticket_name']; ?></td>
            <td nowrap="nowrap"><?php echo $ticket['category']; ?></td>
            <td class="col_amount"><?php echo format_currency($ticket['price']); ?></td>
            <td><?php echo $ticket['quantity']; ?></td>
            <td><?php echo $ticket['expiry_date']; ?></td>
            <td>
                <a href="<?php echo base_url() . 'admin/tickets/edit/' . $ticket['id']; ?>">
                    <img src="<?php echo base_url(); ?>assets/style/img/icons/edit.png" title="Edit"/>
                </a>
                &nbsp;&nbsp;
                <a onclick="return confirm('Are you sure you want to delete?');" 
                   href="<?php echo base_url() . 'admin/tickets/delete/'.$id_cat.'/' . $ticket['id'].'/'.$off_set; ?>">
                    <img src="<?php echo base_url(); ?>assets/style/img/icons/delete.png" title="Delete"/>
                </a>
            </td>
        </tr>
    <?php endforeach; ?>
    <tr>
        <td rowspan="6"><?php echo $pagination; ?></td>
    </tr>
</table>